package com.dxf.sysadmin.controller;

import com.dxf.common.utils.ResultJson;
import com.dxf.sysadmin.entity.Clazz;
import com.dxf.sysadmin.entity.po.SysUserPo;
import com.dxf.sysadmin.entity.qo.ClazzQo;
import com.dxf.sysadmin.entity.qo.SysUserQo;
import com.dxf.sysadmin.service.ClazzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/clazz")
@Api(tags  = "ClazzController|班级控制器")
public class ClazzController {
    @Autowired
    private ClazzService clazzService;

    /**
     * @Description: 班级列表分页查询
     */
    @PostMapping("clazzPage")
    @ApiOperation("班级列表分页查询")
    public ResultJson clazzPage(@RequestBody ClazzQo qry){
        return clazzService.clazzPage(qry);
    }

    /**
     * @Description: 更具id列表删除班级
     */
    @PostMapping("delete")
    @ApiOperation(value = "更具id列表删除班级")
    public ResultJson deleteClazz(@RequestParam("list[]") List<Long>  list){
        return clazzService.deleteClazz(list);
    }

    /**
     * @Description: 新增或者更新班级
     */
    @PostMapping("saveOrUpdate")
    @ApiOperation(value="新增或者更新班级")
    public ResultJson saveOrUpdateClazz( @RequestBody Clazz clazz){
        return clazzService.saveOrUpdateClazz(clazz);
    }
}
